﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using WordShit.Web;
using System.ServiceModel.DomainServices.Client;
using System.Linq;
using System.ComponentModel;
using AdminPanel.ViewModels;

namespace WordShit.ViewModels
{
    public class TreeViewModel : ViewModelBase
    {
        public ObservableCollection<Folder> Folders { get; set; }
        private DomainServiceWord service;
        public TreeViewModel()
        {
            
            service = new DomainServiceWord();
            LoadOperation <Folder> folders = 
            service.Load<Folder>(service.GetFoldersQuery());

            folders.Completed += new EventHandler(folders_Completed);
        }

        void folders_Completed(object sender, EventArgs e)
        {
            Folders = new ObservableCollection<Folder>(service.Folders.ToList());
            this.OnPropertyChanged("Folders");
        }

    }
}
